package com.shunwang.caipiao.data.container;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.shunwang.caipiao.vo.NumberIntervalVo;

public class NumberIntervalContainer {

	public Map<Integer,NumberIntervalSeat> seats = new HashMap<Integer,NumberIntervalSeat>(){{
		this.put(1,new NumberIntervalSeat(33));
		this.put(2,new NumberIntervalSeat(33));
		this.put(3,new NumberIntervalSeat(33));
		this.put(4,new NumberIntervalSeat(33));
		this.put(5,new NumberIntervalSeat(33));
		this.put(6,new NumberIntervalSeat(33));
		this.put(7,new NumberIntervalSeat(15));
		this.put(8,new NumberIntervalSeat(15));
	}};	
	/**
	 * 开出某个号码
	 * @param seat
	 * @param number
	 */
	public void hitSeat(int seat,int number){
		NumberIntervalSeat seatObj = seats.get(seat);
		if(seatObj != null){
			seatObj.hit(number);
		}
	}
	/**
	 * 返回符合平均间隔要求的数字
	 * @param seat
	 * @return
	 */
	public List<NumberIntervalVo> showAvgNumber(int seat){
		NumberIntervalSeat seatObj = seats.get(seat);
		if(seatObj != null){
			return seatObj.showAvgNumber();
		}
		return null;
	}
	/** 返回某个位子top n可能出现的值 */
	public Object getTopAvgInterval(int seat,NumberIntervalContainerCallBack callBack){
			NumberIntervalSeat seatObj = seats.get(seat);
			if(seatObj != null && callBack != null){
				return callBack.doCallBack(seatObj);
			}
			return null;
	}
	
	public Set<Integer> getSeats(){
		return seats.keySet();
	}
}
